from pylons.i18n import lazy_ugettext as _
from repoze.what.predicates import not_anonymous

from chowa.lib.site.navigation import Tab, Menu, MenuItem


__primary_tabs__ = [
    [
        Tab(params=dict(controller='docs', action='divisions'),
            caption=_('Divisions')
        ),
        Tab(params=dict(controller='docs', action='users'),
            caption=_('Users')
        ),
    ],
    [
        Tab(params=dict(controller='docs', action='my'),
            caption=_('My documents')
        ),
        Tab(params=dict(controller='docs', action='favorites'),
            caption=_('Favorites')
        ),
        Tab(params=dict(controller='settings', action='sections'),
            caption=_('Sections')
        ),
    ],
    [
        Tab(params=dict(controller='docs', action='tags'),
            caption=_('Catalog')),
        Tab(params=dict(controller='tags', default__action='index'),
            caption=_('Edit')),
    ]
]


__menus__ = [
    Menu('catalogue.main', caption=_('Catalog'),
         items = [
            MenuItem(params=dict(controller='docs',
                                 action='sections'),
                     ignore_all=True,
                     caption=_('Sections')
            ),
            MenuItem(params=dict(controller='docs',
                                 action='index'),
                     ignore_all=True,
                     caption=_('All documents')
            ),
            MenuItem(params=dict(controller='docs',
                                 action='search'),
                     ignore_all=True,
                     caption=_('Search')
            ),
            MenuItem(params=dict(controller='docs',
                                 action='divisions'),
                     ignore_all=True,
                     caption=_('Divisions')
            ),
            MenuItem(params=dict(controller='docs',
                                 action='users'),
                     ignore_all=True,
                     caption=_('Users')
            ),
        ]
    ),
    Menu('catalogue.personal', caption=_('Personal'),
         protector=not_anonymous(),
         items = [
            MenuItem(params=dict(controller='docs',
                                 action='my'),
                     ignore_all=True,
                     caption=_('My documents')
            ),
            MenuItem(params=dict(controller='docs',
                                 action='favorites'),
                     ignore_all=True,
                     caption=_('Favorites')
            ),
            MenuItem(params=dict(controller='docs',
                                 action='my_division'),
                     ignore_all=True,
                     caption=_('My division')
            ),
            MenuItem(params=dict(controller='document',
                                 action='add'),
                     ignore_all=True,
                     caption=_('Add document')
            ),
            MenuItem(params=dict(controller='settings',
                                 action='sections'),
                     ignore_all=True,
                     caption=_('Select sections')
            ),
        ]
    ),
]
